<?php
/**
 * RSS Feed
 */
class Feed
{
    private $_feed_id;
    private $_feed_url;
    private $_feed_title;
    private $_feed_icon;
    private $_user_favorite;
    private $_user_read;
    private $_category_id;

    private $_posts;

    public function getPosts()
    {
        //$this->_posts[] = new Post
    }

    public function setFavorite()
    {

    }

    public function setShare()
    {

    }

    public function setAllRead()
    {

    }

    public function getUnreadPosts()
    {

    }

    public function forceRefresh()
    {

    }

    public function  __call($name, $arguments)
    {
        if( false !== strpos( $name, 'get_' ) )
        {
            $property = substr( $name, 3, ( strlen( $name ) - 3) );
            if( true === property_exists( $this, $property ) )
            {
                return $this->$property;
            }
        }
        elseif( false !== strpos( $name, 'set_' ) )
        {
            $property = substr( $name, 3, ( strlen( $name ) - 3) );
            if( true === property_exists( $this, $property ) )
            {
                $this->$property = $arguments[0];
            }
        }
    }

    public function __toString()
    {
//            $vars = get_defined_vars($this);
        $json = array();
//            foreach( $vars as $v )
//            {
//                $var = substr($v, 2);
//                echo $var;
//                $json[substr($v, 2)] = $this->$v;
//            }
        return json_encode( $json );

    }
}
